using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;

namespace MaskMgr
{
    public class picturestream
    {
        public System.Drawing.Image ByteToImage(byte[] bytearr)
        {
            MemoryStream ms = new MemoryStream(bytearr);
            System.Drawing.Image Image = Image.FromStream(ms);
            ms.Close();
            return Image;
        }

        public byte[] ImageToByte(System.Drawing.Image image)
        {
            MemoryStream ms = new MemoryStream();
            byte[] imagedata = null;
            image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
            imagedata = ms.GetBuffer();
            return imagedata;
        }
    }
}
